﻿<sap:ActivityDesigner
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="clr-namespace:System;assembly=mscorlib"
    xmlns:sap="clr-namespace:System.Activities.Presentation;assembly=System.Activities.Presentation"
    xmlns:sapv="clr-namespace:System.Activities.Presentation.View;assembly=System.Activities.Presentation"
    xmlns:sapc="clr-namespace:System.Activities.Presentation.Converters;assembly=System.Activities.Presentation"
    xmlns:sacdt="clr-namespace:System.Activities.Core.Presentation.Themes;assembly=System.Activities.Core.Presentation"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:converters="clr-namespace:Vision.Core.ActivityComponents.Converters"
    mc:Ignorable="d"
    x:Class="Vision.Core.ActivityComponents.Collections.DictionaryBuilderDesigner"
    x:Name="activityDesigner"
    Collapsible="True" ExpandState="True">
    <sap:ActivityDesigner.Resources>
        <sapc:ArgumentToExpressionConverter x:Key="ArgumentToExpressionConverter" />
        <converters:TypeOfConverter x:Key="TypeOfConverter" />

        <Style x:Key="AddButtonStyle" TargetType="{x:Type Button}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <!--<ContentPresenter Content="{TemplateBinding Content}" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" />-->
                        <Grid Background="Transparent">
                            <Ellipse x:Name="ellipseAdd" Width="14" Height="14" Stroke="#FF656363" StrokeThickness="2" HorizontalAlignment="Left" VerticalAlignment="Top" />
                            <Path x:Name="pathAdd" Data="M 7,3 L 7,11 M 3,7 11,7" Stroke="#FF656363" StrokeThickness="2" />
                        </Grid>
                        <ControlTemplate.Triggers>
                            <EventTrigger RoutedEvent="Mouse.MouseEnter">
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="ellipseAdd">
                                            <EasingColorKeyFrame KeyTime="0" Value="#FFDA471B"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="pathAdd">
                                            <EasingColorKeyFrame KeyTime="0" Value="#FFDA471B"/>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                            <EventTrigger RoutedEvent="Mouse.MouseLeave">
                                <BeginStoryboard>
                                    <Storyboard>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="ellipseAdd">
                                            <EasingColorKeyFrame KeyTime="0" Value="#FF656363"/>
                                        </ColorAnimationUsingKeyFrames>
                                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)" Storyboard.TargetName="pathAdd">
                                            <EasingColorKeyFrame KeyTime="0" Value="#FF656363"/>
                                        </ColorAnimationUsingKeyFrames>
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

        <DataTemplate x:Uid="DataTemplate_6" x:Key="ExpandedActivityViewTemplate">
            <StackPanel>
                <Grid>
                    <sap:WorkflowItemsPresenter HintText="Drop an AddToDictionary&lt;,&gt; item" Margin="5" Items="{Binding Path=ModelItem.Activities}"> <!-- AllowedItemType="{Binding Path=ModelItem.Activities, Converter={StaticResource TypeOfConverter}}">-->
                        <sap:WorkflowItemsPresenter.SpacerTemplate>
                            <DataTemplate>
                                <StackPanel Background="Transparent">
                                    <Polygon HorizontalAlignment="Center" Margin="5" Fill="White" Stroke="Gray" Points="0,0 16,0 8,8" />
                                </StackPanel>
                            </DataTemplate>
                        </sap:WorkflowItemsPresenter.SpacerTemplate>
                        <sap:WorkflowItemsPresenter.ItemsPanel>
                            <ItemsPanelTemplate>
                                <StackPanel Orientation="Vertical" />
                            </ItemsPanelTemplate>
                        </sap:WorkflowItemsPresenter.ItemsPanel>
                    </sap:WorkflowItemsPresenter>
                </Grid>
            </StackPanel>
        </DataTemplate>

        <DataTemplate x:Uid="DataTemplate_6" x:Key="CollapsedActivityViewTemplate">
            <Label x:Uid="TextBlock_6" Padding="0,0,0,0" FontStyle="Italic" Foreground="{x:Static SystemColors.GrayTextBrush}" HorizontalAlignment="Center" VerticalAlignment="Center" Content="Double-click to view"/>
        </DataTemplate>

        <Style x:Uid="Style_1" x:Key="CollapsibleStyle" TargetType="{x:Type ContentPresenter}">
            <!--<Setter x:Uid="Setter_1" Property="ContentTemplate" Value="{DynamicResource CollapsedActivityViewTemplate}" />-->
            <Setter x:Uid="Setter_1" Property="ContentTemplate" Value="{DynamicResource ExpandedActivityViewTemplate}" />
            <Style.Triggers>
                <DataTrigger x:Uid="DataTrigger_1" Binding="{Binding ShowExpanded}" Value="false">
                    <Setter x:Uid="Setter_2" Property="ContentTemplate" Value="{DynamicResource CollapsedActivityViewTemplate}" />
                </DataTrigger>
            </Style.Triggers>
        </Style>
    </sap:ActivityDesigner.Resources>

    <ContentPresenter x:Uid="ContentPresenter" Style="{DynamicResource CollapsibleStyle}" Content="{Binding}" />
</sap:ActivityDesigner>
